class Fixnum
  def to_s_with_digits(n)
    selfs = self.to_s
    selfl = selfs.length
    diff = n - selfl
    
    return selfs if diff <= 0
    return "0"*diff + selfs
  end
  
  def closest_nonnegative
    if self < 0
      return 0
    else
      return self
    end
  end
end